package com.ruoyi.wechat.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/wechat/dict")
public class WxDictController extends BaseController {
    @Autowired
    private ISysDictTypeService dictTypeService;
    /**
     * 根据字典类型查询字典类型数据信息
     */
    @GetMapping(value = "/type/{dictType}")
    public AjaxResult dictType(@PathVariable String dictType){
        List<SysDictData> data=dictTypeService.selectDictDataByType(dictType);
                    if(StringUtils.isNull(data)){
                        data=new ArrayList<SysDictData>();
                    }
                    return success(data);
    }
}
